<%--
  Created by IntelliJ IDEA.
  User: LWW
  Date: 2017/11/14
  Time: 11:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div class="container-fluid">
    <div class="col-md-4">
      <a href="${pageContext.request.contextPath }/admin/index.jsp"><img src="${pageContext.request.contextPath}/img/logo2.png" /></a>
    </div>
    <div class="col-md-5">
        <img src="${pageContext.request.contextPath}/img/header.png" />
    </div>
    <div class="col-md-3" style="padding-top:20px">
        <ol class="list-inline">
            <c:if test="${empty users }">
                <li><a
                        href="${pageContext.request.contextPath }/jsp/login.jsp">登录</a></li>
                <li><a
                        href="${pageContext.request.contextPath }/jsp/register.jsp">注册</a></li>

            </c:if>
            <c:if test="${not empty users }">
                ${users.name }:您好
                <li><a
                        href="${pageContext.request.contextPath }/user/logout.do">退出</a></li>
                <li><a
                        href="${pageContext.request.contextPath }/order/findOrderList.do">我的订单</a></li>
                <li><a href="${pageContext.request.contextPath}/myCollection.do?uid=${users.uid}">我的收藏</a></li>
            <li><a href="${pageContext.request.contextPath}/jsp/cart.jsp">购物车</a></li>
            </c:if>
        </ol>
    </div>
</div>
<div class="container-fluid">
    <nav class="navbar navbar-inverse">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="/index.do">首页</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav" id="menuId">
                    <%--<c:forEach items="${requestScope.categories}" var="item">--%>
                        <%--<li><a href="#">${item.cname}</a></li>--%>
                    <%--</c:forEach>--%>
                </ul>
                <form class="navbar-form navbar-right" role="search">
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="Search">
                    </div>
                    <button type="submit" class="btn btn-default">Submit</button>
                </form>

            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container-fluid -->
    </nav>
</div>
<script>
  $.get(
      "/getCategory.do",
      "",
      function(dt, status, xhr) {
        for (var i = 0; i < dt.length; i++) {
          var o = dt[i];
          var cid = dt[i].cid;
          var name = dt[i].cname;
          $("#menuId").append("<li><a href=\"${pageContext.request.contextPath}/product/asCategoryFindProduct.do?cid=" + cid + "\">" +
              name +"</a></li>")
        }
      },
      "json"
  );

</script>
</body>
</html>
